﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DTO;
namespace DAO
{
   public class LichQLDAO
    {
       public List<LichQLDTO> DanhSachTheoNgay(int ngay)
       {
           List<LichQLDTO> ds = new List<LichQLDTO>();
           SqlConnection conn = new SqlConnection();
           conn = DataProvider.ConnectDB();

           SqlCommand cmd = new SqlCommand("proc_DanhSachTheoNgay", conn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter sqlPar;
           sqlPar = new SqlParameter("@ngay", SqlDbType.Int);
           sqlPar.Direction = ParameterDirection.Input;
           sqlPar.Value = ngay;
           cmd.Parameters.Add(sqlPar);
           SqlDataReader reader = cmd.ExecuteReader();
           while (reader.Read())
           {
               LichQLDTO cal = new LichQLDTO();
               cal.MaMA = reader.GetString(0);
               cal.NgayLL = reader.GetDateTime(1);
               ds.Add(cal);
           }
           conn.Close();
           return ds;
       }
    }
}
